package com.wframe.project.jnd.services;


import java.util.List;
import java.util.Map;

import com.frame.database.JdataBean;
import com.frame.database.PageResult;
import com.wframe.project.jnd.rest.util.ClientException;
import com.wframe.project.jnd.vo.*;
import org.springframework.transaction.annotation.Transactional;

public interface OrderService {

    public JdataBean loadFaretemp();

    public void addToCart(String userid, String productid, String priceid, int amount) throws Exception;

    public void delCart(String userid, String cartid);

    public void updateCartCount(String userid, String cartid, Integer count);

    public List<Map> queryCart(String userid);

    public String generateorder(String userid, List<JdataBean> carts, double freight) throws Exception;

    public String wxgenerateorder(String userid, List<JdataBean> carts, double freight) throws Exception;

    public String generateorder2(String userid, List<PriceBeanVo> priceids, double freight) throws Exception;

    public List<Map> queryOrderProduct(String ordercode);

    public int queryOrderProductTotalAmount(String ordercode);

    public List<Map> queryBackOrderProduct(String orderid);

    public JdataBean getOrderByCode(String ordercode);

    public double calculateFreight(String province, String city, int amount);

    public String submitOrder(String userid, JdataBean order, String cartids, String ordercode) throws Exception;

    public void orderOk(String paycode);

    public void payOk(String paycode);

    public PageResult queryOrders(JdataBean parms, int size, int pno) throws Exception;

    public PageResult queryOrderProduct(JdataBean parms, int size, int pno) throws Exception;
    @Transactional
    public void receiptGoods(String userid, String ordercode) throws Exception;

    public String backorder(JdataBean bean) throws Exception;

    public JdataBean getBackOrder(String orderid);

    public void cancelorder(String ordercode, String userid) throws Exception;

    public void cancelbackorder(String orderid, String userid) throws Exception;

    public PageResult queryOften(JdataBean parms, int size, int pageno);

    public void delOften(String userid, String priceid);

    public void addOften(String userid, String priceid) throws Exception;

    public JdataBean statStatusNum(String userid) throws Exception;

    public int statCartnum(String userid) throws Exception;

    public void receiptchecktask(int day) throws Exception;

    public List<Map> checkStock(List<PriceBeanVo> prices);

    public List<Map> checkProductstatus(List<PriceBeanVo> prices);

    boolean checkOften(String userid, String priceid);

    List<CartItem> findOrderItem(String ordercode);

    /**
     * 更新商品为未同步状态
     *
     * @param status
     * @param syn
     */
    void updateStatus(int status, int syn);

    /**
     * 更新商品信息
     *
     * @param columnMap
     * @param keyMap
     */
    void update(Map columnMap, Map keyMap);

    /**
     * 查找微信支付页显示数据
     *
     * @param code
     * @return
     * @throws ClientException
     */
    JdataBean findOrderTips(String code);

    void updateStatusCode(String code, String payway, String paysn);

    /**
     * 更新常购清单
     *
     * @param price
     */
    void updateOften(PriceBeanVo price);

    void updateConfirmByCode(String code);

    List<CartItem> findCartProducts(String userid);

    List<CartItem> findCartProducts(String userid, Integer[] ids);

    String generateOrder(String userId, String[] ids, CartBean bean) throws Exception;

    public void delCart(String userid, String[] ids);

    List<CartItem> findOrderProducts(String code);

    CartBean buyAgain(String userid, List<CartItem> items) throws Exception;

    public List<JdataBean> queryStatusCount(String userid);

    Map<String, List<UrgentProduct>> checkProducts(String userid, List<PriceBeanVo> prices, int ordinal);

    Map<String, List<Map>> checkProducts(String userid, Map<Integer, CartItem> items, int ordinal);

    void integralSendTask(int day) throws Exception;
}
